<!--
 * @Descripttion: 提货单提货地址
 * @version:
 * @Author: Bryant
 * @Date: 2021-07-12 11:03:50
 * @LastEditors: Bryant
 * @LastEditTime: 2021-07-12 12:04:17
-->
<template>
  <div>
    <div>
      <el-tooltip effect="light" content="点击复制" placement="bottom">
        <i
          class="el-icon-copy-document tag-read"
          :data-clipboard-text="data.takeDeliveryOfGoodsAddress"
          @click="copy"
        ></i>
      </el-tooltip>
      {{ pickAddress }}
    </div>
  </div>
</template>
<script>
import Clipboard from "clipboard";
export default {
  props: ["field", "data"],
  data() {
    return {
      pickAddress: ""
    };
  },
  mounted() {
    if (this.data.takeDeliveryOfGoodsAddress) {
      this.pickAddress = this.data.takeDeliveryOfGoodsAddress;
    }
  },
  methods: {
    copy() {
      var clipboard = new Clipboard(".tag-read");
      clipboard.on("success", e => {
        this.$message.success("复制成功");
        // 释放内存
        clipboard.destroy();
      });
      clipboard.on("error", e => {
        // 不支持复制
        this.$message.error("该浏览器不支持自动复制");
        // 释放内存
        clipboard.destroy();
      });
    }
  }
};
</script>
<style scoped></style>

<style lang="scss">
.row-item {
  color: #3f4652;
  line-height: 28px;
  margin-bottom: 14px;
}
</style>
